package com.agent.vpsserver.common.enmus;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;

/**
 * @author: guochao
 * @create: 2024/3/29
 **/
@Getter
@AllArgsConstructor
public enum ESMSActivateGetStatusActivation {
    WAIT_CODE("STATUS_WAIT_CODE", "等待短信", "Waiting sms."),
    WAIT_RETRY("STATUS_WAIT_RETRY", "“过去的不合适代码”-等待代码完善", "Waiting for code clarification."),
    WAIT_RESEND("STATUS_WAIT_RESEND", "等待重新发送短信，必须按重新发送短信并将状态更改为6", "Waiting for re-sending SMS."),
    CANCEL("STATUS_CANCEL", "激活取消", "Activation canceled."),
    OK("STATUS_OK", "激活码 - 收到的代码", "Code received."),
    UNKNOWN("UNKNOWN", "未知状态", "Unknown status activation.");

    /**
     * Response from server.
     */
    private final String response;

    /**
     * Message on ch language.
     */
    private final String chMessage;

    /**
     * Message on english language.
     */
    private final String englishMessage;

    /**
     * Returns the state activation by name.
     *
     * @param name state activation name.
     * @return state activation.
     */
    @NotNull
    public static ESMSActivateGetStatusActivation getStatusByName(@NotNull String name) {
        name = name.toUpperCase();

        for (ESMSActivateGetStatusActivation stateActivationResponse : values()) {
            if (stateActivationResponse.getResponse().equals(name)) {
                return stateActivationResponse;
            }
        }

        return UNKNOWN;
    }
}
